package com.ylb.rent.controller;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.ylb.rent.config.PageConfig;
import com.ylb.rent.dao.BedMapper;
import com.ylb.rent.entity.Bed;
import com.ylb.rent.util.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/bed/bed")
public class BedController {
    @Autowired
    BedMapper bedMapper;

    @PreAuthorize("@ss.hasPermi('bed:bed:list')")
    @GetMapping("/list")
    public String getList(Bed bed, PageConfig pageConfig){
        PageHelper.startPage(pageConfig);
        System.out.println("wozai"+bed.toString());
        List<Bed> list=bedMapper.selectBedList();
        return R.successJSONData(new PageInfo<>(list));
    }
}
